﻿package net.steam.easyjoboa.dao;

import java.io.Serializable;
import java.util.List;
import net.steam.easyjoboa.entity.PageBean;
import net.steam.easyjoboa.entity.PageBeans;


/**
 * 
 * @author Administrator
 *
 * @param <K> 代表主键的类型
 * @param <V> 代表实体类的类型
 */
public interface BaseDao<K extends Serializable, V extends Serializable> {
	
	/**
	 * 新增方法
	 * @param entity
	 * @return
	 */
	public K addEntity(V entity) throws Exception ;
	
	/**
	 * 按ID删除实体类对象
	 * @param key
	 */
	public void deleteEntity(K key) throws Exception;
	
	public void updateEntity(V entity);
	
	public V findById(K key);
	
	/**
	 * 
	 * @param hql
	 * @param params 
	 * @return
	 */
	public List<V> find(String hql, Object... params);
	
	/**
	 * 分页查询
	 */
	public List<V> find(PageBean pb, String hql, Object... params);
	
	public List<V> findByPage(PageBeans pb, String hql, Object... params);
	
}
